import jakarta.servlet.ServletException;
import jakarta.servlet.annotation.WebServlet;
import jakarta.servlet.http.HttpServlet;
import jakarta.servlet.http.HttpServletRequest;
import jakarta.servlet.http.HttpServletResponse;

import java.io.IOException;

/**
 * @author 86187
 * @classname JumpServlet
 * @time 2024/3/18
 * @project javaweb_project
 */
@WebServlet("/jump")
public class JumpServlet extends HttpServlet {
    @Override
    protected void doPost(HttpServletRequest req, HttpServletResponse resp) throws ServletException, IOException {
        super.doPost(req, resp);
        System.out.println("JumpServlet的doPost方法被执行了");
        resp.sendRedirect("/rd");
    }
    @Override
    protected void doGet(HttpServletRequest req, HttpServletResponse resp) throws ServletException, IOException {
        System.out.println("JumpServlet的doGet方法被执行了");
        req.getRequestDispatcher("/rt").forward(req,resp);
    }
}


